package org.duoyi.striver.service.log;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.AppenderBase;
import org.duoyi.striver.gui.controller.SideBarController;

/**
 * 界面日志输出
 */
public class GuiLogAppender extends AppenderBase<LoggingEvent> {

    @Override
    protected void append(LoggingEvent loggingEvent) {
        String message = loggingEvent.getFormattedMessage();
        Level level = loggingEvent.getLevel();
        SideBarController.getInstance().addLog(message, level);
    }
}
